import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/personnel_statistics_entity.dart';

PersonnelStatisticsEntity $PersonnelStatisticsEntityFromJson(Map<String, dynamic> json) {
  final PersonnelStatisticsEntity personnelStatisticsEntity = PersonnelStatisticsEntity();
  final int? certifiedSafetyEngineer = jsonConvert.convert<int>(json['certifiedSafetyEngineer']);
  if (certifiedSafetyEngineer != null) {
    personnelStatisticsEntity.certifiedSafetyEngineer = certifiedSafetyEngineer;
  }
  final int? dedicatedSafetyPersonnel = jsonConvert.convert<int>(json['dedicatedSafetyPersonnel']);
  if (dedicatedSafetyPersonnel != null) {
    personnelStatisticsEntity.dedicatedSafetyPersonnel = dedicatedSafetyPersonnel;
  }
  final int? personInChargeNum = jsonConvert.convert<int>(json['personInChargeNum']);
  if (personInChargeNum != null) {
    personnelStatisticsEntity.personInChargeNum = personInChargeNum;
  }
  final int? personInChargeOfSafety = jsonConvert.convert<int>(json['personInChargeOfSafety']);
  if (personInChargeOfSafety != null) {
    personnelStatisticsEntity.personInChargeOfSafety = personInChargeOfSafety;
  }
  final int? registeredEmployeesOfEnterprises = jsonConvert.convert<int>(json['registeredEmployeesOfEnterprises']);
  if (registeredEmployeesOfEnterprises != null) {
    personnelStatisticsEntity.registeredEmployeesOfEnterprises = registeredEmployeesOfEnterprises;
  }
  final int? specialOperations = jsonConvert.convert<int>(json['specialOperations']);
  if (specialOperations != null) {
    personnelStatisticsEntity.specialOperations = specialOperations;
  }
  return personnelStatisticsEntity;
}

Map<String, dynamic> $PersonnelStatisticsEntityToJson(PersonnelStatisticsEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['certifiedSafetyEngineer'] = entity.certifiedSafetyEngineer;
  data['dedicatedSafetyPersonnel'] = entity.dedicatedSafetyPersonnel;
  data['personInChargeNum'] = entity.personInChargeNum;
  data['personInChargeOfSafety'] = entity.personInChargeOfSafety;
  data['registeredEmployeesOfEnterprises'] = entity.registeredEmployeesOfEnterprises;
  data['specialOperations'] = entity.specialOperations;
  return data;
}

extension PersonnelStatisticsEntityExtension on PersonnelStatisticsEntity {
  PersonnelStatisticsEntity copyWith({
    int? certifiedSafetyEngineer,
    int? dedicatedSafetyPersonnel,
    int? personInChargeNum,
    int? personInChargeOfSafety,
    int? registeredEmployeesOfEnterprises,
    int? specialOperations,
  }) {
    return PersonnelStatisticsEntity()
      ..certifiedSafetyEngineer = certifiedSafetyEngineer ?? this.certifiedSafetyEngineer
      ..dedicatedSafetyPersonnel = dedicatedSafetyPersonnel ?? this.dedicatedSafetyPersonnel
      ..personInChargeNum = personInChargeNum ?? this.personInChargeNum
      ..personInChargeOfSafety = personInChargeOfSafety ?? this.personInChargeOfSafety
      ..registeredEmployeesOfEnterprises = registeredEmployeesOfEnterprises ?? this.registeredEmployeesOfEnterprises
      ..specialOperations = specialOperations ?? this.specialOperations;
  }
}
